class IUP_CBOX
-- Container for position elements in absolute coordinates. It is a 
-- concrete layout container.
-- The IupCbox is equivalent of a IUP_VBOX or IUP_HBOX where all the 
-- children have the FLOATING attribute set to YES, but children must use 
-- CX and CY attributes instead of the POSITION attribute.

inherit
	IUP_CONTAINER
	IUP_WIDGET_EXPAND
	IUP_WIDGET_SIZE
	IUP_WIDGET_RASTERSIZE
	IUP_WIDGET_USERSIZE
	IUP_WIDGET_WID
	IUP_WIDGET_FONT
	IUP_WIDGET_CLIENTSIZE
	IUP_WIDGET_CLIENTOFFSET
	IUP_WIDGET_POSITION
	IUP_WIDGET_MAXMIN_SIZE
	IUP_WIDGET_CHILD
	IUP_WIDGET_NAME
	IUP_WIDGET_CUSTOM_ATTRIBUTES

create {ANY}
	cbox_empty,
   cbox
	
feature {ANY}
	
	cbox_empty
	   -- Create an empty cbox
		local
			p, a_cbox: POINTER
		do
			a_cbox := int_cbox_empty (p)
			set_widget(a_cbox)
		end
		
	cbox (col: ARRAY[IUP_WIDGET])
	   -- Create a new cbox containing the list of widgets
		local
         iterator: ITERATOR[IUP_WIDGET]; i: INTEGER; arg: NATIVE_ARRAY[POINTER]; s: IUP_WIDGET; a_cbox: POINTER
		do
			i := col.count
			arg := arg.calloc(i)
			iterator := col.new_iterator
			i := 0
			
			from
				iterator.start
         until
				iterator.is_off
         loop
            s := iterator.item
            arg.put(s.widget, i)
				iterator.next
            i := i + 1
         end

			a_cbox := int_cbox (arg.to_external)
			set_widget(a_cbox)
		end
		
feature {}

	-- Internals
	
	int_cbox_empty (arguments: POINTER): POINTER
		external "plug_in"
      alias "{
         location: "${sys}/plugins"
         module_name: "iup"
         feature_name: "IupCbox"
         }"
      end
	
   int_cbox (arguments: POINTER): POINTER
		external "plug_in"
      alias "{
         location: "${sys}/plugins"
         module_name: "iup"
         feature_name: "IupCboxv"
         }"
      end
	
end -- class IUP_CBOX

-- The MIT License (MIT)

-- Copyright (c) 2016, 2017 by German A. Arias

-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in 
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
